<template>
  <SonComponent ref="son" :age="age" @change-age="changeAge" v-model="wage"></SonComponent>
  <hr />
  <el-button @click="changeAge">改变AGE</el-button>
  <el-button @click="runSonFun">调用子组件方法</el-button>
  <div>{{ wage }}</div>
</template>

<script lang="ts" setup>
import { ref } from 'vue'
import { ElMessage } from 'element-plus'
import SonComponent from './ElementPlusSonView.vue'

const age = ref(28)
function changeAge(message:string) {
  age.value++
  console.log('点击了', age.value, typeof message)
  if (message && (typeof message) === 'string') {
    ElMessage(message)
  }
}

const son = ref()
function runSonFun() {
  son.value.test()
}

const wage = ref(10000)
</script>

<style scoped lang="less">

</style>

